package com.yueyang.sojourn.server.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author andy.yang
 * @summary 支付步骤 枚举
 * @Copyright (c) 2020, Yueyang Group All Rights Reserved.
 * @since 2020-03-26
 */
@AllArgsConstructor
public enum PayStepEnum implements IEnum {
    /**
     * 支付步骤 枚举
     */
    PREPAY(100, "已预支付"),
    GET_PAY_RSULT(200, "获取支付结果"),
    PAID(210, "已支付"),
    ADDING_RECEIVER(300, "待添加分账方"),
    ADDED_RECEIVER(310, "已添加分账方"),
    SHARING(400, "待分账"),
    SHARED(410, "已分账"),
//    SHARED(420, "分账待退款"),

    CLOSED(-1, "已关闭");

    @Getter
    private int code;

    @Getter
    private String desc;

    public static PayStepEnum ofCode(Integer code) {
        return Arrays.stream(PayStepEnum.values()).filter(operStatusEnum -> operStatusEnum.code == code).findFirst().orElse(null);
    }
}
